<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePaymentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('payments', function (Blueprint $table) {
            $table->bigIncrements('id')->unsigned()->comment('提现/充值表');
            $table->integer('user_id')->comment('用户id');
            $table->string('account', 50)->comment('账户');
            $table->string('acc_password', 50)->nullable()->comment('账户密码');
            $table->string('payment_method', 20)->comment('支付方式');
            $table->decimal('amount', 10, 2)->nullable()->comment('支付金额');
            $table->enum('action', ['top_up', 'withdraw'])->comment('动作：充值、提现');
            $table->string('status')->default('pending')->comment('状态');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('payments');
    }
}
